/*
 * Copyright 2001-2006 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.training.killerapp;

import java.util.Collection;

import com.training.killerapp.model.Page;
import com.training.killerapp.model.User;

/**
 * Interface for a Killer App data store.
 * 
 * @since 1.0
 */
public interface KillerAppDataStore
{
    /**
     * Adds a given User to the Killer App.
     * 
     * @param user the new User to add
     * 
     * @return the unique ID (email)
     */
    String createUser( User user );

    /**
     * Updates an existing User in the Killer App.
     * 
     * @param user the User entry to update - email must be set
     */
    void updateUser( User user );

    void deleteUser( User user );

    Collection getUserCollection();

    /**
     * Retrieves an existing User in the Killer App.
     * 
     * @param email the key of the User to get
     * 
     * @return user matching the email
     */
    User getUser( String email );

    /**
     * Adds a page to the Killer App.
     * 
     * @param page the new Page to create - owner must be set
     * @param ownerEmail the key of the User owning the page
     * 
     * @return the unique page ID
     */
    int createPage( Page page, String ownerEmail );

    /**
     * Updates an existing page in the Killer App.
     * 
     * @param page the new Page to create - id must be set
     */
    void updatePage( Page page );

    /**
     * Retrieves a page in the Killer App.
     * 
     * @param page the unique ID of the page to retrieve
     */
    Page getPage( int page );
}
